﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Speedy
{
    public class dbProductPromotion : MasterTable
    {
        public Column id { get; set; }
        public Column promoId { get; set; }
        public Column productId { get; set; }
        public Column promoProductId { get; set; }
        public Column customerId { get; set; }
        ISynchronizer sqlinstance;


        public dbProductPromotion()
        {
            this.id = new Column(typeof(int), "ID", 4, false, false, true);
            this.promoId = new Column(typeof(int), "PROMOTION_ID", 4, false, true);
            this.productId = new Column(typeof(int), "PRODUCT_ID", 4, false, true);
            this.promoProductId = new Column(typeof(int), "PRM_PRODUCT_ID");
            this.customerId = new Column(typeof(int), "CUSTOMER_ID");

            this.TableName = "PRODUCT_PROMOTION";
            this.Columns.Add(this.id);
            this.Columns.Add(this.promoId);
            this.Columns.Add(this.productId);
            this.Columns.Add(this.promoProductId);
            this.Columns.Add(this.customerId);

            string defaultval = "";
            if (Config.GetConfig.GetValue(CParams.Db).IndexOf("Mikro") > -1)
                defaultval = "Mikro V12";
            else
                defaultval = "WorkGroup";

            if (Config.GetConfig.GetValue(CParams.ProgramType, defaultval) == "WorkGroup")
                sqlinstance = new syncWorkGrup();
            else
                sqlinstance = new syncMikroV12();
        }


        public override System.Data.DataTable AllData()
        {
            return DataLayer.GetLayer.FillData(sqlinstance.UrunPromosyonListesi());
        }

    }
}
